var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (t, o) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, t) {
              e.__proto__ = t;
            }) ||
          function (e, t) {
            for (var o in t)
              Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
          })(t, o);
      };
      return function (t, o) {
        function i() {
          this.constructor = t;
        }
        if ("function" != typeof o && null !== o)
          throw new TypeError(
            "Class extends value " + String(o) + " is not a constructor or null"
          );
        e(t, o),
          (t.prototype =
            null === o
              ? Object.create(o)
              : ((i.prototype = o.prototype), new i()));
      };
    })(),
  ExperiencePool = (function (e) {
    function t() {
      var t = e.call(this) || this;
      return (
        (t.max = 99),
        (t.min = 1),
        (t.step = 1),
        (t.num = 1),
        (t.list_exp_pool.vScrollBarSkin = ""),
        (t.list_exp_pool.selectEnable = !0),
        (t.list_exp_pool.renderHandler = new Handler(
          t,
          t.updateExpPoolHandler
        )),
        t.list_exp_pool.on(Laya.Event.CLICK, t, t.onDidRadioSelectedAction),
        t.btn_exp_store.on(Laya.Event.CLICK, t, t.onLoadExpStoreAction),
        t.btn_exp_plus.on(Laya.Event.CLICK, t, t.onDidRecoverClick),
        t.btn_exp_dele.on(Laya.Event.CLICK, t, t.onDidRecoverClick),
        t.slider_expDetail.on(Laya.Event.CHANGE, t, t.sliderChange),
        WebSocketService.addListener({
          caller: t,
          code: 1907,
          method: t.onLoadCanAddHeroExpList,
        }),
        WebSocketService.addListener({
          caller: t,
          code: 1906,
          method: t.onsureUseExpFn,
        }),
        t
      );
    }
    return (
      __extends(t, e),
      (t.showExpPoolView = function () {
        return (
          null == this.poolV &&
            ((this.poolV = new t()), (this.poolV.zOrder = 1e3)),
          this.poolV.popup(!0),
          (this.poolV.selectIndex = 0),
          (this.poolV.slider_expDetail.value = 0),
          (this.poolV.slider_expDetail.min = 0),
          (this.poolV.max = 0),
          (this.poolV.min = 0),
          (this.poolV.num = 0),
          (this.poolV.label_storage_exp.text = "0 经验值"),
          WebSocketService.send({ c: 1907 }),
          (this.poolV.label_exp_store_num.text = this.poolV.num + ""),
          this.poolV
        );
      }),
      (t.prototype.onLoadCanAddHeroExpList = function (e) {
        if (0 == e.code) {
          for (var t = void 0, o = e.list, i = [], n = 0; n < o.length; n++) {
            var l = o[n];
            (t = {
              radio_exp_name: {
                label: Utils.dealTransAndLvl(l.roleType, l.lvl) + l.name,
              },
              id: l.id,
              roleType: l.roleType,
            }),
              i.push(t);
          }
          (this.list_exp_pool.dataSource = i),
            i.length > 0 && (this.slider_expDetail.value = 0);
        }
        (this.label_storage_exp.text = e.more + "经验值"),
          (this.slider_expDetail.max = e.more),
          (this.max = e.more);
      }),
      (t.prototype.updateExpPoolHandler = function (e, t) {
        var o = e.getChildByName("radio_exp_name");
        this.selectIndex == t
          ? ((o.selected = !0), (this.list_exp_pool.selectedIndex = t))
          : (o.selected = !1);
      }),
      (t.prototype.onDidRadioSelectedAction = function (e) {
        "" != e.target.name &&
          (this.selectIndex = this.list_exp_pool.selectedIndex);
      }),
      (t.prototype.onLoadExpStoreAction = function () {
        var e = this.list_exp_pool.selectedItem.id;
        if (this.slider_expDetail.value <= 0)
          ToastView.toastView("请添加注入经验");
        else {
          var t = this.slider_expDetail.value + "";
          WebSocketService.send({ c: 1906, d: { cid: e, exp: t } });
        }
      }),
      (t.prototype.onDidRecoverClick = function (e) {
        "item1" == e.target.name
          ? ((this.num = this.num + this.step),
            this.num > this.max && (this.num = this.max),
            (this.slider_expDetail.value = this.num))
          : "item0" == e.target.name &&
            ((this.num = this.num - this.step),
            this.num < this.min && (this.num = this.min),
            (this.slider_expDetail.value = this.num)),
          this.updateMedicalData();
      }),
      (t.prototype.sliderChange = function () {
        (this.num = this.slider_expDetail.value), this.updateMedicalData();
      }),
      (t.prototype.updateMedicalData = function () {
        this.label_exp_store_num.text = this.num + "";
      }),
      (t.prototype.onsureUseExpFn = function (e) {
        0 == e.code && WebSocketService.send({ c: 1907 }),
          ToastView.toastView(e.msg);
      }),
      t
    );
  })(ui.Estatemarket.ExperiencePoolUI);
